<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>table模块快速使用</title>
    <link rel="stylesheet" href="kit_admin/plugins/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="kit_admin/src/css/login.css">
</head>

<body>
<div class="kit-search-mored layui-anim layui-anim-upbit">
	<div class="kit-search-body">
	   <div class="layui-form-item" style="margin-top: 40px">
	   <form class="layui-form" >
	       <div class="layui-inline">
	           <label class="layui-form-label">角色编码</label>
	           <div class="layui-input-inline">
	               <input type="text"  name="code" autocomplete="off" class="layui-input" lay-verify="required">
	           </div>
	       </div>
	       <div class="layui-inline">
	           <label class="layui-form-label">角色名称</label>
	           <div class="layui-input-inline">
	               <input type="text"  name="name" autocomplete="off" class="layui-input" lay-verify="required">
	           </div>
	       </div>
	       <button id="m_submit" lay-submit="submit" lay-filter="m_submit"></button>
	       </form>
	   </div>
	</div>
</div>


    <script src="kit_admin/plugins/layui/layui.js"></script>
   <!--  <script src="kit_admin/plugins/layui/lay/modules/jquery.js"></script> -->
    
    <script>
    var kh={
    		commit:""
    };
    layui.use(['layer', 'form'], function() {
        var form = layui.form,
        $ = layui.jquery;
	    form.on('submit(m_submit)', function(formData) {
		    	$.ajax({
	   	  		 url: "menuController.do?doRoleAdd",
	            type: "post",
	            data: formData.field,
	            dataType: "json",
	            success: function(data) {
		            	 if(1 != data.code){
		             		layer.msg(data.message);
		             		return ;
		             }
	            	 	var index = parent.layer.getFrameIndex(window.name);
	            	 	parent.layer.close(index);
	            },
	            error: function(XMLHttpRequest, textStatus, errorThrown) {
	                /* alert(XMLHttpRequest.status);
	                alert(XMLHttpRequest.readyState);
	                alert(textStatus); */
	                layer.msg("网络问题，请联系管理员");
	            }
	   	  	});
            return false;
	    });
	    kh.commit=function(){
	    		$("#m_submit").click();
	    }
    });
    
    </script>
</body>

</html>